/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BD;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ARMGARCES
 */
@Entity
@Table(name = "materiaprima")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Materiaprima.findAll", query = "SELECT m FROM Materiaprima m"),
    @NamedQuery(name = "Materiaprima.findByIdMateriaPrima", query = "SELECT m FROM Materiaprima m WHERE m.idMateriaPrima = :idMateriaPrima"),
    @NamedQuery(name = "Materiaprima.findByDescripcion", query = "SELECT m FROM Materiaprima m WHERE m.descripcion = :descripcion"),
    @NamedQuery(name = "Materiaprima.findByUnidad", query = "SELECT m FROM Materiaprima m WHERE m.unidad = :unidad"),
    @NamedQuery(name = "Materiaprima.findByBulto", query = "SELECT m FROM Materiaprima m WHERE m.bulto = :bulto"),
    @NamedQuery(name = "Materiaprima.findByPaleta", query = "SELECT m FROM Materiaprima m WHERE m.paleta = :paleta")})
public class Materiaprima implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idMateriaPrima")
    private Integer idMateriaPrima;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private String descripcion;
    @Basic(optional = false)
    @Column(name = "unidad")
    private int unidad;
    @Basic(optional = false)
    @Column(name = "bulto")
    private int bulto;
    @Basic(optional = false)
    @Column(name = "paleta")
    private int paleta;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkidMateriaPrima")
    private List<InventarioMp> inventarioMpList;
    @JoinColumn(name = "fk_idCategoria_mp", referencedColumnName = "idCategoria_mp")
    @ManyToOne(optional = false)
    private CategoriaMp fkidCategoriamp;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkidMateriaPrima")
    private List<ItemocMp> itemocMpList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkidMateriaPrima")
    private List<CatalogoMp> catalogoMpList;

    public Materiaprima() {
    }

    public Materiaprima(Integer idMateriaPrima) {
        this.idMateriaPrima = idMateriaPrima;
    }

    public Materiaprima(Integer idMateriaPrima, String descripcion, int unidad, int bulto, int paleta) {
        this.idMateriaPrima = idMateriaPrima;
        this.descripcion = descripcion;
        this.unidad = unidad;
        this.bulto = bulto;
        this.paleta = paleta;
    }

    public Integer getIdMateriaPrima() {
        return idMateriaPrima;
    }

    public void setIdMateriaPrima(Integer idMateriaPrima) {
        this.idMateriaPrima = idMateriaPrima;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public int getUnidad() {
        return unidad;
    }

    public void setUnidad(int unidad) {
        this.unidad = unidad;
    }

    public int getBulto() {
        return bulto;
    }

    public void setBulto(int bulto) {
        this.bulto = bulto;
    }

    public int getPaleta() {
        return paleta;
    }

    public void setPaleta(int paleta) {
        this.paleta = paleta;
    }

    @XmlTransient
    public List<InventarioMp> getInventarioMpList() {
        return inventarioMpList;
    }

    public void setInventarioMpList(List<InventarioMp> inventarioMpList) {
        this.inventarioMpList = inventarioMpList;
    }

    public CategoriaMp getFkidCategoriamp() {
        return fkidCategoriamp;
    }

    public void setFkidCategoriamp(CategoriaMp fkidCategoriamp) {
        this.fkidCategoriamp = fkidCategoriamp;
    }

    @XmlTransient
    public List<ItemocMp> getItemocMpList() {
        return itemocMpList;
    }

    public void setItemocMpList(List<ItemocMp> itemocMpList) {
        this.itemocMpList = itemocMpList;
    }

    @XmlTransient
    public List<CatalogoMp> getCatalogoMpList() {
        return catalogoMpList;
    }

    public void setCatalogoMpList(List<CatalogoMp> catalogoMpList) {
        this.catalogoMpList = catalogoMpList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMateriaPrima != null ? idMateriaPrima.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Materiaprima)) {
            return false;
        }
        Materiaprima other = (Materiaprima) object;
        if ((this.idMateriaPrima == null && other.idMateriaPrima != null) || (this.idMateriaPrima != null && !this.idMateriaPrima.equals(other.idMateriaPrima))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "BD.Materiaprima[ idMateriaPrima=" + idMateriaPrima + " ]";
    }
    
}
